import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:speed_random/app_styles.dart';
import 'package:speed_random/common/common_fuc.dart';
import 'package:speed_random/global_data.dart';
import 'package:share_plus/share_plus.dart';

class itemRandListList extends StatelessWidget {
  final Map<String, dynamic> numbers;
  final VoidCallback onTopPressed;
  final VoidCallback onEditPressed;
  final VoidCallback onEditTitlePressed;
  final VoidCallback onDelePressed;
  const itemRandListList({
    Key? key,
    required this.numbers,
    required this.onTopPressed,
    required this.onEditPressed,
    required this.onEditTitlePressed,
    required this.onDelePressed,
  }) : super(key: key);



  @override
  Widget build(BuildContext context) {

    return Card(
      elevation: 3, // 设置卡片阴影
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(12), // 设置卡片圆角
        side: BorderSide(
          color: AppStyles.colorOkButbg, // 设置边框颜色
          width: 1, // 设置边框宽度
        ),
      ),
     // color: AppStyles.colorPagebg, // 设置卡片背景颜色
     // margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 16), // 设置卡片外边距
      child: ListTile(
        onTap:onTopPressed ,
        title: Text(
          numbers["title"],
          style: const TextStyle(
          //  color: Colors.black,
            fontSize: 18,
           // fontWeight: FontWeight.bold,

          ),
        ),
        subtitle: Text(
          "${numbers["list"]}",
          style: const TextStyle(
           // color: Color(0xff454343),
            fontSize: 14,
          ),
        ),
       // ... 其他代码保持不变 ...

trailing: PopupMenuButton<String>(
  icon: Icon(Icons.more_horiz, color: AppStyles.colorOkButbg),
  itemBuilder: (BuildContext context) => <PopupMenuEntry<String>>[
    PopupMenuItem<String>(
      value: 'rename',
      child: Text('重命名'.tr),
    ),
    PopupMenuItem<String>(
      value: 'edit',
      child: Text('修改'.tr),
    ),
    PopupMenuItem<String>(
      value: 'delete',
      child: Text('删除'.tr),
    ),
  ],
  onSelected: (String value) {
    switch (value) {
      case 'rename':
        // 实现重命名逻辑
        onEditTitlePressed();
        break;
      case 'edit':
        // 实现修改逻辑
      onEditPressed();
        break;
      case 'delete':
        // 实现删除逻辑
      onDelePressed();
        break;
    }
  },
),

// ... 其他代码保持不变 ...

    ));
  }
}
